home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
C64
/
U-Utilities
/
(c)u1.d64
/
timer.c
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2007-02-04
|
2KB
|
66 lines
10 U=0:T=0:S=0:E=0:T=30:V=60:W=V*V:F=0:H=0:M=O:G=0:O=0:X=0:R$="":T$="":U$=""
20 V$="":C=0:Z$="00:00:00":P$="":GOTO170
30 F=INT(E/W):H=INT(F/V):M=INT(F-(H*V))
40 G=E/W-F:O=INT(G*V+.5):IFO=VTHENO=0:M=M+1
50 A=H:GOSUB70:R$=A$+":":A=M:GOSUB70:R$=R$+A$+":":A=O:GOSUB70:R$=R$+A$
60 RETURN
70 A$=STR$(A):A$=RIGHT$(A$,(LEN(A$)-1)):IFLEN(A$)=1THENA$="0"+A$
80 RETURN
90 A0$=" [146]":A1$=" ":B$=""
100 PRINTA0$"[157]";:FORA=1TOV:GETA$:IFA$=""THENNEXT:A$=A0$:A0$=A1$:A1$=A$:GOTO100
110 A=V:NEXT:A=ASC(A$)AND127:IFA=13THENPRINT" ":RETURN
120 IFA=19ORA=17ORA=29ORA=34ORA$="[148]"THEN100
130 IFA=20ANDLEN(B$)<1THEN90
140 IFA=20ANDLEN(B$)=1THENPRINTA$;:GOTO90
150 B$=B$+A$:IFA=20THENB$=LEFT$(B$,LEN(B$)-2)
160 PRINTA$;:GOTO100
170 POKE53280,1:POKE53281,1:POKE53272,21:PRINT"[144][147]":REM C64 MODS 1983 BY WIM
180 PRINT"THIS PROGRAM WAS DESIGNED TO MEASURE
185 [153]"THE AMOUNT OF TIME SPENT BY A RADIO OR
200 PRINT"TELEVISION STATION ON NEWS, SPORTS,
210 [153]"ADS, OR WHATEVER, BUT IT CAN TIME UP TO
220 PRINT"NINE DIFFERENT CATEGORIES (DETERMINED
225 [153]"BY YOU) OF ANYTHING.
230 PRINT"TO WORK THE PROGRAM AS A BROADCAST
235 [153]"MONITOR, YOU MUST BE LISTENING TO THE
240 PRINT"STATION SO THAT YOU CAN TELL ME WHEN
250 [153]"EACH CATEGORY BEGINS.
260 PRINT"I WILL CUMULATE THE TIME SPENT IN EACH
270 [153]"CATEGORY. WHEN YOU ASK, I WILL GIVE
275 PRINT"THE PERCENT OF THE TOTAL TIME FOR EACH
277 [153]"CATEGORY.
280 PRINT"HOW MANY CATEGORIES DO YOU WANT? ";:GOSUB90:IFB$=""THEN280
290 B=VAL(B$):IFB<2ORB>9THENPRINT"2 TO 9 CATEGORIES POSSIBLE.":GOTO280
300 PRINT"NOW ENTER THE NAME OF EACH CATEGORY.
310 [153]"USE NAMES OF 10 LETTERS OR LESS.":[129]I[178]1[164]B
320 [153]I"? ";:[141]90:[139]B$[178]""[167]320
330 [139][195](B$)[177]10[167]B$[178][200](B$,10)
340 B$(I)[178]B$:[130]
350 [153]"NOW TURN ON THE RADIO OR TV AND TYPE
360 PRINT"THE NUMBER OF THE CATEGORY THAT IS
370 [153]"CURRENTLY BEING AIRED. THEN EACH TIME
380 PRINT"THE STATION STARTS A DIFFERENT CATEGORY
390 [153]"TYPE THE NUMBER OF THAT CATEGORY.
395 PRINT"IF YOU TYPE 0, I WILL GIVE THE
398 [153]"CURRENT PERCENTAGES.
400 PRINT"TYPE R WHEN YOU'RE READY. ";:GOSUB90:IFB$<>"R"THEN400
410 PRINT"[147]CATEGORY THIS TIME ALL TIME
420 [129]I[178]1[164]B:[153]I;B$(I)[163]15)Z$[163]27)Z$:[130]
430 [153][200](P$,12)"TOTAL TIME: "Z$
440 [161]B$:[139]B$[178]""[167][153]"ON":[137]440
450 C[178][197](B$):[139]C[178]0[176]C[177]B[167][153]"ON";:[137]440
460 D[178]C:TI$[178]"000000":X[178]TI:[153][200](P$,C[170]1)[163]3)""B$(C)
470 [153][200](P$,C[170]1);[163]15)U$;[163]27)T$:[153]P$;[163]12)V$
490 [161]B$:[139]B$[178]""[167]520
495 [139]B$[178]"0"[167][141]600
500 C[178][197](B$):[139]C[178]0[176]C[177]B[167][153]"ON":C[178]D:[137]490
510 C(C)[178]0:[153][200](P$,D[170]1)[163]3)B$(D):[153][200](P$,C[170]1)[163]3)""B$(C):D[178]C
520 U[178][181]((TI[170]T)[173]V)[172]V:S[178]U[171]X:X[178]U:F(C)[178]F(C)[170]S:E[178]F(C):[141]30:T$[178]R$
530 C(C)[178]C(C)[170]S:E[178]C(C):[141]30:U$[178]R$:E[178]U:[141]30:V$[178]R$:[137]470
600 [153]P$"";:[129]I[178]1[164]40:[153]"LEN";:[130]
605 E[178]U:[141]30:[153]P$"STATISTICS AS OF "R$:[153]:[129]I[178]1[164]B
610 A[178][181]((F(I)[173]E)[172]1000)[173]10:A$[178]" "[170][196](A):A$[178][201](A$,5)
615 [139][202](A$,4,1)[179][177]"."[167]A$[178][201](A$,3)[170]".0"
620 [153]I;B$(I)[163]14)A$" % "
630 [130]:[142]